<script setup>
import { ref } from 'vue'
import MyButton from './components/MyButton.vue';
var num = ref(0);

function onAdd(e) {
  num.value = e;
  console.log(num.value);
}
</script>

<template>
  {{ num }}
  <MyButton :num="num" @add="onAdd"></MyButton>
</template>

 

 <!-- ParentComponent.vue -->


<!-- <template>
  <div>
    <p>Parent Num: {{ num }}</p>
    <MyButton :num="num" @update-num="updateNum" ></MyButton>
  </div>
</template>

<script setup>
import MyButton from './components/MyButton.vue';
import { ref } from 'vue'

const num = ref(0)

function updateNum(newNum) {
  num.value = newNum
}
</script> -->